package com.android.topview.watermelon.account.reposity

import com.android.topview.watermelon.account.entity.Account
import com.android.topview.watermelon.application.appContext
import com.android.topview.watermelon.database.AppDatabase

object AccountRepository {
    private  val accountDao = AppDatabase.getDatabase(appContext).accountDao()

    fun getAllAccount():List<Account>{

        return accountDao.loadAllAccounts()
    }

    fun addAccount(account: Account):Long{
        return accountDao.insertAccount(account)
    }


    fun getIncomes():List<Account>{
        return accountDao.loadIncomeOrCost(false)
    }

    fun getCosts():List<Account>{
        return accountDao.loadIncomeOrCost(true)
    }

    fun deleteAccount(account: Account){
        return  accountDao.deleteAccount(account)
    }


}